#ifndef APPSTATE_H
#define APPSTATE_H

#include <QtCore>
#include "mainWindow.h"
#include "soapHandler.h"

class SoapHandler;

class WaitState : public QState
{
    Q_OBJECT
public:
               WaitState( QState *parent = 0 );
               WaitState( int maxT, QState *parent = 0 );
              ~WaitState() {}

signals:
         void  waitingDone();

public slots:
         void  go();

protected:
 virtual void  onEntry( QEvent * );
 virtual void  onExit ( QEvent * );

public:
         bool  dontWait;
          int  maxTime;
       QTimer  timer;
};

class LocDepState : public QState
{
    Q_OBJECT
public:
               LocDepState( QState *parent = 0 );
              ~LocDepState() {}

signals:
         void  changed();

public slots:
         void  newLatLon( QString );

protected:
 virtual void  onEntry( QEvent * );
 virtual void  onExit ( QEvent * );

public:
      QString  latLon;
         bool  latLonChanged;
};

class AppState : public QStateMachine
{
public:
               AppState( MainWindow *mw, SoapHandler *sh );

private:
         void  defineLocation( QState *ps );
         void  defineForecast( QState *ps );
         void  defineImageGen( QState *ps );
         void  defineCalendar( QState *ps );
         void  defineRadar(    QState *ps );
   MainWindow *mainWin;
  SoapHandler *soapHnd;
};

#endif // APPSTATE_H
